/**
* @Author: Zhengfeng.Yao
* @Date:   2017-01-23 14:12:23
* @Last modified by:   Zhengfeng.Yao
* @Last modified time: 2017-02-09 14:49:42
*/

import React, { Component } from 'react';
import cn from 'classnames';
import './itemSelect.less';

class Item extends Component {
  render() {
    const { selected, children, onClick } = this.props;
    return (
      <div className={cn('aegis-itemSelect-item', {
          'aegis-itemSelect-item-selected': selected
        })}
        onClick={onClick}
        >
          { children }
          <span className="aegis-itemSelect-item-checked anticon"/>
        </div>
    );
  }
}

export default class ItemSelect extends Component {
  static Item = Item;

  render() {
    const { children } = this.props;
    return (
      <div className="aegis-itemSelect">
        {
          children
        }
      </div>
    );
  }
}
